﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ApplicationLibrary.ExtendedControls;
using ApplicationLibrary.Preferences;
using ApplicationLibrary.SqlConnector;

namespace ApplicationLibrary.DBManager
{
    public interface iScrounger
    {
        List<Scrounger> ScroungerList { get; }
    }

    public class Scrounger : IDisposable
    {
        #region Virtual Method

        public virtual void InitializerComponent()
        {
        }

        public virtual void OnLoad()
        {
        }

        public virtual void OnBindData()
        {
        }

        public virtual void OnAttachData(DBManager dbManager)
        {
        }

        public virtual void OnDisableControlsForNew()
        {
        }

        public virtual void OnDisableControlsForEdit()
        {
        }

        public virtual void OnAddSplitMenuButton()
        {
        }

        public virtual void OnValidateControl()
        {
        }

        public virtual void OnPrepareAuxData()
        {
        }

        public virtual void OnCustomButtonClick(ToolStripButton button)
        {
        }

        public virtual void OnCustomizeToolbar(ToolStrip toolstrip)
        {
        }

        public virtual bool OnEnableToolbarButtons(ToolStripButton sender)
        {
            return true;
        }

        public virtual void OnAddPreferenceButton(PreferenceForm prefForm)
        {
        }

        public virtual bool OnPrintDocument(PrintInfo sender, printerForm pf)
        {
            return true;
        }

        public virtual bool OnBeforeAddNew()
        {
            return true;
        }

        public virtual bool OnAfterAddNew()
        {
            return true;
        }

        public virtual bool OnBeforeDelete()
        {
            return true;
        }

        public virtual bool OnAfterDelete()
        {
            return true;
        }

        public virtual bool OnBeforeSave()
        {
            return true;
        }

        public virtual bool OnSaveButton()
        {
            return true;
        }

        public virtual bool OnAfterSave()
        {
            return true;
        }

        public virtual bool OnBeforeUndo()
        {
            return true;
        }

        public virtual List<SqlABParameter> CreateSlaveParam(string name)
        {
            return null;
        }

        public virtual void SetParameters(DBManager dbManager, IRadarParameters key, DBCollection collection)
        {
        }

        public virtual string CreateSlaveQuery(string name)
        {
            return string.Empty;
        }

        public virtual void MasterRowUpdated(DBManager dbManager, SqlABRowUpdatedEventArgs e)
        {
        }

        public virtual void RowUpdating(DBManager dbManager, SqlABRowUpdatingEventArgs e)
        {
        }

        #endregion

        private DocumentForm guestForm = null;

        public Scrounger(iScrounger form)
        {
            guestForm = form as DocumentForm;
        }

        public void Dispose()
        {
        }

        #region MessageBox Overload

        public DialogResult MyMessageBox(string text)
        {
            return guestForm.MyMessageBox(text);
        }

        public DialogResult MyMessageBox(string text, string caption)
        {
            return guestForm.MyMessageBox(text, caption);
        }

        public DialogResult MyMessageBox(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            return guestForm.MyMessageBox(owner, text, caption, buttons, icon);
        }

        public DialogResult MyMessageBox(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            return guestForm.MyMessageBox(text, caption, buttons, icon);
        }

        #endregion
    }
}